<template>
  <div id="app">
    <div v-if="$route.meta.keepAlive">
      <van-nav-bar
        title="标题"
        left-text="返回"
        right-text="退出"
        left-arrow
        @click-left="onClickLeft"
        @click-right="onClickRight"
      />
      <van-tabbar v-model="active">
        <van-tabbar-item icon="home-o" to="/Home">主页</van-tabbar-item>
        <van-tabbar-item icon="search" to="/Adopt">领养</van-tabbar-item>
        <van-tabbar-item icon="friends-o" to="/Register">交流</van-tabbar-item>
        <van-tabbar-item icon="setting-o" to="/Settings">设置</van-tabbar-item>
      </van-tabbar>
      <router-view/>
    </div>
    <router-view v-if="!$route.meta.keepAlive"></router-view>
  </div>
</template>

<script>
export default {
  name: 'App',
  data () {
    return {
      active: 0
    }
  },
  methods: {
    onClickLeft () {
      this.$router.go(-1)
    },
    onClickRight () {
      this.$router.push('/')
    }
  }
}
</script>

<style>
</style>
